import { createSlice } from "@reduxjs/toolkit";
export const counterSlice = createSlice({
  name: "counter",
  initialState: {
    from: "北京",
    to: "上海",
    timer: "11月1日",
  },
  reducers: {
    upfromAndto(state) {
      let temp = state.from;
      state.from = state.to;
      state.to = temp;
    },
    upTimer(state, action) {
      state.timer = action.payload;
    },
  },
});
export default counterSlice.reducer;
export const { upfromAndto, upTimer } = counterSlice.actions;
